From f41c59cce3be046727b23b71b7afcfece889aeab Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 3 Nov 2004 06:16:43 +0000 Subject: [PATCH] Don't crash if the active_row reference has become invalid. (#157156, 2004-11-03 Matthias Clasen * gtk/gtkcombobox.c (gtk_combo_box_get_active): Don't crash if the active_row reference has become invalid. (#157156, Christophe Fergeau) --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtkcombobox.c | 9 +++++++-- 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea539e007a..61c83ea521 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-11-03 Matthias Clasen + + * gtk/gtkcombobox.c (gtk_combo_box_get_active): Don't crash + if the active_row reference has become invalid. (#157156, + Christophe Fergeau) + 2004-11-02 Matthias Clasen * gtk/gtkwindow.c (gtk_window_activate_key_after): As diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ea539e007a..61c83ea521 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2004-11-03 Matthias Clasen + + * gtk/gtkcombobox.c (gtk_combo_box_get_active): Don't crash + if the active_row reference has become invalid. (#157156, + Christophe Fergeau) + 2004-11-02 Matthias Clasen * gtk/gtkwindow.c (gtk_window_activate_key_after): As diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index ea539e007a..61c83ea521 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +2004-11-03 Matthias Clasen + + * gtk/gtkcombobox.c (gtk_combo_box_get_active): Don't crash + if the active_row reference has become invalid. (#157156, + Christophe Fergeau) + 2004-11-02 Matthias Clasen * gtk/gtkwindow.c (gtk_window_activate_key_after): As diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index ea539e007a..61c83ea521 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +2004-11-03 Matthias Clasen + + * gtk/gtkcombobox.c (gtk_combo_box_get_active): Don't crash + if the active_row reference has become invalid. (#157156, + Christophe Fergeau) + 2004-11-02 Matthias Clasen * gtk/gtkwindow.c (gtk_window_activate_key_after): As diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index aabb3b3c1e..2b88dc09ea 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -4212,8 +4212,13 @@ gtk_combo_box_get_active (GtkComboBox *combo_box) { GtkTreePath *path; path = gtk_tree_row_reference_get_path (combo_box->priv->active_row); - result = gtk_tree_path_get_indices (path)[0]; - gtk_tree_path_free (path); + if (path == NULL) + result = -1; + else + { + result = gtk_tree_path_get_indices (path)[0]; + gtk_tree_path_free (path); + } } else result = -1; -- 2.30.2